{extend name="layout/detail" /}

{block name="content"}
<div class="td-content-wrap p20">
    <div class="td-content-header">
        <h1 class="main-title">编辑签到规则</h1>
    </div>
    <hr>
    <div class="space-20"></div>
    <form id="form_data" class="layui-form" method="post">
        <input type="hidden" name="opmode" value="edit">
        <input type="hidden" name="id" value="{$vo.id}">
        <div class="layui-form-item">
                <label class="layui-form-label required">分类名称：</label>
                <div class="layui-input-block w19">
                    <input type="text" name="name" placeholder="分类名称" class="layui-input" check="required" info="分类名称" value="{$vo.name}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">分类代码：</label>
                <div class="layui-input-block w19">
                    <input type="text" name="code" placeholder="分类代码" class="layui-input" check="required" info="分类代码" value="{$vo.code}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">图标：</label>
                <div class="layui-input-block w19">
                    <input type="text" name="icon" placeholder="图标" class="layui-input" value="{$vo.icon}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">类型：</label>
                <div class="layui-input-block w9">
                    <input type="text" name="type" placeholder="类型" class="layui-input" check="required" info="类型" value="{$vo.type}">
                </div>
            </div>       
        <hr>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <a class="layui-btn" onclick="save();">保存</a>
                <a class="layui-btn layui-btn-primary" onclick="go_return_url();">取消</a>
            </div>
        </div>
    </form>
</div>
{/block}

{block name="script"}
<script>
    layui.use(['form', 'ueditor', 'uploader'], function () {
        let fn = {
            select_category: function () {
                popup_open("{:url('select_category')}", 560, 470);
            },
            save: function () {
                send_form("form_data", "{:url('save')}", function (res) {
                    if (res.code) {
                        layer.msg(res.msg, {
                            time: 1200
                        }, function () {
                            location.href = "{:url('index')}";
                        });
                    } else {
                        layer.msg(res.msg);
                        return false;
                    }
                });
            }
        };
        win_exp(fn);
    });
</script>
{/block}
